Skip to content

[pull] master from GaijinEntertainment:master#837

Merged
pull[bot] merged 12 commits into
forksnd:masterfrom
GaijinEntertainment:master
Mar 22, 2026
Merged

[pull] master from GaijinEntertainment:master#837
pull[bot] merged 12 commits into
forksnd:masterfrom
GaijinEntertainment:master

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented Mar 22, 2026

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

borisbat and others added 12 commits March 21, 2026 08:33
Compile-time AST lint pass detecting common string performance anti-patterns:
- PERF001: string += in loop (O(n^2))
- PERF002: character_at with loop variable index (O(n) per call)
- PERF003: character_at anywhere (informational)
- PERF004: string interpolation reassignment in loop (O(n^2))
- PERF005: length(string) in while condition (strlen each iteration)

Uses counter-based detection via visitor state to catch loop variables
nested in expressions (e.g. character_at(s, i+1)). Includes proper
variable scope tracking, closure isolation, and deprecation of character_at.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ucture

Replace parsing-based warning detection in standalone tool with direct
perf_lint(prog, false) call. Make test functions optimization-safe by
adding parameters and return values. Remove makeFunctionDeprecated from
C++ (character_at deprecation now handled by PERF003 lint rule).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add O(1) first_character() for both string and das_string (throws on empty)
- Add with_das_string() to create temporary das_string for block scope
- Optimize character_at() to scan only to index instead of full strlen
- Replace character_at usage in aot_cpp.das with first_character, slice, and fixed_array indexing
- Add perf_lint.rst to language toctree, fix Sphinx warnings
- Add handmade docs for new functions and macro_performance_warning
- Tests: 5 subtests covering both overloads, empty-throws, and bounds checks

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Rename perf004_* fields to descriptive string_builder_* names
- Replace print() with to_log(LOG_WARNING) in perf_lint.das
- Flatten nested ifs with postfix conditional returns
- Early-return guard in visitExprCall using postfix syntax
- Remove spaces before ++/-- operators (project convention)
- Move visitor adapter from class field to local variable
- Shorten test docs section in perf_lint.rst
- Replace if(true) with bare scope block in main.das
- Remove unnecessary threadlock_context and unsafe wrapper

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add performance lint module, first_character/with_das_string builtins, optimize character_at
- Fix PERF001 (string += in loop) in constant_expression, coverage,
  interfaces, rst (5 functions converted to build_string)
- Fix PERF003 (character_at(s,0)) in json_boost, regex, rst,
  strings_boost by replacing with first_character
- Fix PERF002 (character_at in loop) in regex expand_replacement
  and strings_boost is_null_or_whitespace using peek_data
- Improve perf_lint: detect character_at(s, 0) and suggest
  first_character in PERF003 message
- Fix perf_lint: PERF003 now fires inside closures (was incorrectly
  skipped by in_closure guard)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fix PERF001 warning in split_sptn -- character-by-character string
building replaced with strings_boost split().

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- 27_testing: replace character_at loop with peek_data in is_palindrome
- 42_testing_tools: replace string += loop with build_string in reverse_string
- call_macro_mod: cache length(format) outside while condition (PERF005)
- reader_macro_mod: replace string += loop with build_string
- typeinfo_macro_mod: replace string += loop with build_string
- 07_sse_and_streaming: replace character_at loop with peek_data in SSE parser
- Update 4 RST files with matching code changes

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fix perf_lint warnings across daslib, modules, tutorials
@pull pull Bot locked and limited conversation to collaborators Mar 22, 2026
@pull pull Bot added the ⤵️ pull label Mar 22, 2026
@pull pull Bot merged commit e045739 into forksnd:master Mar 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant